var Point = {
	createNew: function() {
		var len = arguments.length;
		var point = {};
		switch(len) {
			case 0:
				point.x = 0;
				point.y = 0;
				break;
			case 2:
				point.x = arguments[0];
				point.y = arguments[1];
				break;
		}
		return point;
	}
};

// 用于标识起点和终点
var TypePoint = {
	// 参数数为0时，构造一个对象；参数数位3时，构造带值的对象
	createNew: function() {
		var len = arguments.length;
		var point = {};
		switch(len) {
			case 0:
				point = Point.createNew();
				point.type = 0; //0、无意义;1、起点;2、终点。
				break;
			case 3:
				point = Point.createNew(arguments[0], arguments[1]);
				point.type = arguments[2];
				break;
		}
		return point;
	}
};

// 用于标记垂足
var VerticalPoint = {
	createNew: function() {
		var len = arguments.length;
		var point = {};
		switch(len) {
			case 2:
				if(typeof(arguments[1]) == "number") {
					point = Point.createNew(arguments[0], arguments[1]);
					point.ana = null;
				} else {
					point = Point.createNew(arguments[0].x, arguments[0].y);
					point.ana = arguments[1]; //0、无意义;1、起点;2、终点。
				}
				break;
			case 3:
				point = Point.createNew(arguments[0], arguments[1]);
				point.ana = arguments[2];
				break;
		}
		return point;
	}
};


/*
 * 用于标记拐点
 */
var InflectionPoint = {
	createNew: function() {
		var len = arguments.length;
		var point = {};
		switch(len) {
			case 1:
				point = Point.createNew(arguments[0].x, arguments[0].y);
				point.d = MAX_NUM;
				break;
			case 2:
				point = Point.createNew(arguments[0], arguments[1]);
				point.d = MAX_NUM;
				break;
			case 3:
				point = Point.createNew(arguments[0], arguments[1]);
				point.d = arguments[2];
				break;
			case 4:
				point = Point.createNew(arguments[0], arguments[1]);
				point.d = arguments[2];
				point.pre = Point.createNew(arguments[3].x,arguments[3].y);
				break;
		}
		return point;
	}
}

// 存放解析式
var Analytical = {
	createNew: function() {
		var len = arguments.length;
		var analytical = {};
		switch(len) {
			case 5:
				analytical.p1 = arguments[0];
				analytical.p2 = arguments[1];
				analytical.k = arguments[2];
				analytical.b = arguments[3];
				analytical.d = arguments[4];
				break;
			case 7:
				analytical.p1 = Point.createNew(arguments[0], arguments[1]);
				analytical.p2 = Point.createNew(arguments[2], arguments[3]);
				analytical.k = arguments[4];
				analytical.b = arguments[5];
				analytical.d = arguments[6];
				break;
		}
		return analytical;
	}
}